	.data
cr:
	.asciiz "\n"
sp:
	.asciiz " "
CURRENT_HEAPPTR:
	.word 0
CURRENT_HEAPSIZE:
	.word 0
main_HEAP:
	.word 0
main_HEAPSIZE:
	.word 80
fillArray_HEAP:
	.word 0
fillArray_HEAPSIZE:
	.word 4
printArray_HEAP:
	.word 0
printArray_HEAPSIZE:
	.word 4
quickSort_HEAP:
	.word 0
quickSort_HEAPSIZE:
	.word 28
	.text
	.globl main
main:
	la $t1, main_HEAPSIZE
	la $t2, CURRENT_HEAPSIZE
	lw $t3, 0($t1)
	sw $t3, 0($t2)
	addi $t4,$sp,0
	addi $sp, $sp, -32000
	addi $t1, $sp, 0
	addi $t1, $t1, -32000
	la $t2, main_HEAP
	sw $t1, 0($t2)
	la $t2, CURRENT_HEAPPTR
	sw $t1, 0($t2)
	sw $ra, 4($sp)
	jal main1
	lw $ra,4($sp)
	jr $ra
main1:
	j fillArray_end
fillArray:
	move $t1, $zero
	addi $t1, $t1, 0
	blez $t1, PopProcArgsLoopEndfillArray
	move $t1, $zero
PopProcArgsLoopfillArray:
	lw $t2,4($sp)
	addi $sp, $sp, -4
	la $t3, CURRENT_HEAPPTR
	lw $t3, 0($t3)
	add $t3, $t3, $t1
	sw $t2, 0($t3)
	addi $t1, $t1, 4
	blt $t1, 0, PopProcArgsLoopfillArray
PopProcArgsLoopEndfillArray:
	li $t0, 1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 0
	addi $t4,$t4,4
	lw $t1,0($t4)
	la $t2, fillArray_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	sw $t1,0($t0) 
LABEL17:
	li $t0, 20
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 0
	la $t2, fillArray_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	addi $t4,$t4,4
	lw $t1,0($t4)
	sle $t0, $t0, $t1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 0
	addi $t4,$t4,4
	lw $t1,0($t4)
	seq $t0, $t0, $t1
	bnez $t0, LABEL18
	li $t0, 6
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 0
	la $t2, fillArray_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 20
	addi $t4,$t4,4
	lw $t1,0($t4)
	sub $t0, $t0, $t1
	addi $t4,$t4,4
	lw $t1,0($t4)
	div $t0, $t1
	mfhi $t0
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 4
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 0
	la $t2, fillArray_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	addi $t4,$t4,4
	lw $t1,0($t4)
	sub $t0, $t0, $t1
	addi $t4,$t4,4
	lw $t1,0($t4)
	mul $t0, $t0, $t1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 0
	addi $t4,$t4,4
	lw $t1,0($t4)
	add $t0, $t0, $t1
	addi $t4,$t4,4
	lw $t1,0($t4)
	la $t2, main_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	sw $t1,0($t0) 
	li $t0, 1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 0
	la $t2, fillArray_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	addi $t4,$t4,4
	lw $t1,0($t4)
	add $t0, $t0, $t1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 0
	addi $t4,$t4,4
	lw $t1,0($t4)
	la $t2, fillArray_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	sw $t1,0($t0) 
	j LABEL17
LABEL18:
	jr $ra
fillArray_end:
	j printArray_end
printArray:
	move $t1, $zero
	addi $t1, $t1, 0
	blez $t1, PopProcArgsLoopEndprintArray
	move $t1, $zero
PopProcArgsLoopprintArray:
	lw $t2,4($sp)
	addi $sp, $sp, -4
	la $t3, CURRENT_HEAPPTR
	lw $t3, 0($t3)
	add $t3, $t3, $t1
	sw $t2, 0($t3)
	addi $t1, $t1, 4
	blt $t1, 0, PopProcArgsLoopprintArray
PopProcArgsLoopEndprintArray:
	li $t0, 1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 0
	addi $t4,$t4,4
	lw $t1,0($t4)
	la $t2, printArray_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	sw $t1,0($t0) 
LABEL15:
	li $t0, 20
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 0
	la $t2, printArray_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	addi $t4,$t4,4
	lw $t1,0($t4)
	sle $t0, $t0, $t1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 0
	addi $t4,$t4,4
	lw $t1,0($t4)
	seq $t0, $t0, $t1
	bnez $t0, LABEL16
	li $t0, 4
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 0
	la $t2, printArray_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	addi $t4,$t4,4
	lw $t1,0($t4)
	sub $t0, $t0, $t1
	addi $t4,$t4,4
	lw $t1,0($t4)
	mul $t0, $t0, $t1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 0
	addi $t4,$t4,4
	lw $t1,0($t4)
	add $t0, $t0, $t1
	la $t2, main_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	move $t2, $t0
	addi $sp,$sp,4
	sw $ra, 4($sp)
	addi $sp,$sp,4
	sw $t2, 4($sp)
	jal Print
	lw $ra,4($sp)
	addi $sp, $sp, -4
	li $t0, 1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 0
	la $t2, printArray_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	addi $t4,$t4,4
	lw $t1,0($t4)
	add $t0, $t0, $t1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 0
	addi $t4,$t4,4
	lw $t1,0($t4)
	la $t2, printArray_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	sw $t1,0($t0) 
	j LABEL15
LABEL16:
	jr $ra
printArray_end:
	j quickSort_end
quickSort:
	move $t1, $zero
	addi $t1, $t1, 8
	blez $t1, PopProcArgsLoopEndquickSort
	move $t1, $zero
PopProcArgsLoopquickSort:
	lw $t2,4($sp)
	addi $sp, $sp, -4
	la $t3, CURRENT_HEAPPTR
	lw $t3, 0($t3)
	add $t3, $t3, $t1
	sw $t2, 0($t3)
	addi $t1, $t1, 4
	blt $t1, 8, PopProcArgsLoopquickSort
PopProcArgsLoopEndquickSort:
	li $t0, 4
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 8
	addi $t4,$t4,4
	lw $t1,0($t4)
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	sw $t1,0($t0) 
	li $t0, 0
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 12
	addi $t4,$t4,4
	lw $t1,0($t4)
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	sw $t1,0($t0) 
	li $t0, 4
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 2
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 0
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 4
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	addi $t4,$t4,4
	lw $t1,0($t4)
	add $t0, $t0, $t1
	addi $t4,$t4,4
	lw $t1,0($t4)
	div $t0, $t1
	mflo $t0
	addi $t4,$t4,4
	lw $t1,0($t4)
	sub $t0, $t0, $t1
	addi $t4,$t4,4
	lw $t1,0($t4)
	mul $t0, $t0, $t1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 0
	addi $t4,$t4,4
	lw $t1,0($t4)
	add $t0, $t0, $t1
	la $t2, main_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 20
	addi $t4,$t4,4
	lw $t1,0($t4)
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	sw $t1,0($t0) 
	li $t0, 1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 24
	addi $t4,$t4,4
	lw $t1,0($t4)
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	sw $t1,0($t0) 
LABEL13:
	li $t0, 1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 24
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	addi $t4,$t4,4
	lw $t1,0($t4)
	seq $t0, $t0, $t1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 0
	addi $t4,$t4,4
	lw $t1,0($t4)
	seq $t0, $t0, $t1
	bnez $t0, LABEL14
LABEL11:
	li $t0, 20
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 4
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 8
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	addi $t4,$t4,4
	lw $t1,0($t4)
	sub $t0, $t0, $t1
	addi $t4,$t4,4
	lw $t1,0($t4)
	mul $t0, $t0, $t1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 0
	addi $t4,$t4,4
	lw $t1,0($t4)
	add $t0, $t0, $t1
	la $t2, main_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	addi $t4,$t4,4
	lw $t1,0($t4)
	slt $t0, $t0, $t1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 0
	addi $t4,$t4,4
	lw $t1,0($t4)
	seq $t0, $t0, $t1
	bnez $t0, LABEL12
	li $t0, 1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 8
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	addi $t4,$t4,4
	lw $t1,0($t4)
	add $t0, $t0, $t1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 8
	addi $t4,$t4,4
	lw $t1,0($t4)
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	sw $t1,0($t0) 
	j LABEL11
LABEL12:
LABEL9:
	li $t0, 20
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 4
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 12
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	addi $t4,$t4,4
	lw $t1,0($t4)
	sub $t0, $t0, $t1
	addi $t4,$t4,4
	lw $t1,0($t4)
	mul $t0, $t0, $t1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 0
	addi $t4,$t4,4
	lw $t1,0($t4)
	add $t0, $t0, $t1
	la $t2, main_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	addi $t4,$t4,4
	lw $t1,0($t4)
	sgt $t0, $t0, $t1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 0
	addi $t4,$t4,4
	lw $t1,0($t4)
	seq $t0, $t0, $t1
	bnez $t0, LABEL10
	li $t0, 1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 12
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	addi $t4,$t4,4
	lw $t1,0($t4)
	sub $t0, $t0, $t1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 12
	addi $t4,$t4,4
	lw $t1,0($t4)
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	sw $t1,0($t0) 
	j LABEL9
LABEL10:
	li $t0, 12
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 8
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	addi $t4,$t4,4
	lw $t1,0($t4)
	sle $t0, $t0, $t1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 0
	addi $t4,$t4,4
	lw $t1,0($t4)
	seq $t0, $t0, $t1
	bnez $t0, LABEL7
	li $t0, 4
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 8
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	addi $t4,$t4,4
	lw $t1,0($t4)
	sub $t0, $t0, $t1
	addi $t4,$t4,4
	lw $t1,0($t4)
	mul $t0, $t0, $t1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 0
	addi $t4,$t4,4
	lw $t1,0($t4)
	add $t0, $t0, $t1
	la $t2, main_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 16
	addi $t4,$t4,4
	lw $t1,0($t4)
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	sw $t1,0($t0) 
	li $t0, 4
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 12
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	addi $t4,$t4,4
	lw $t1,0($t4)
	sub $t0, $t0, $t1
	addi $t4,$t4,4
	lw $t1,0($t4)
	mul $t0, $t0, $t1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 0
	addi $t4,$t4,4
	lw $t1,0($t4)
	add $t0, $t0, $t1
	la $t2, main_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 4
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 8
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	addi $t4,$t4,4
	lw $t1,0($t4)
	sub $t0, $t0, $t1
	addi $t4,$t4,4
	lw $t1,0($t4)
	mul $t0, $t0, $t1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 0
	addi $t4,$t4,4
	lw $t1,0($t4)
	add $t0, $t0, $t1
	addi $t4,$t4,4
	lw $t1,0($t4)
	la $t2, main_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	sw $t1,0($t0) 
	li $t0, 16
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 4
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 12
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	addi $t4,$t4,4
	lw $t1,0($t4)
	sub $t0, $t0, $t1
	addi $t4,$t4,4
	lw $t1,0($t4)
	mul $t0, $t0, $t1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 0
	addi $t4,$t4,4
	lw $t1,0($t4)
	add $t0, $t0, $t1
	addi $t4,$t4,4
	lw $t1,0($t4)
	la $t2, main_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	sw $t1,0($t0) 
	li $t0, 1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 8
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	addi $t4,$t4,4
	lw $t1,0($t4)
	add $t0, $t0, $t1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 8
	addi $t4,$t4,4
	lw $t1,0($t4)
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	sw $t1,0($t0) 
	li $t0, 1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 12
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	addi $t4,$t4,4
	lw $t1,0($t4)
	sub $t0, $t0, $t1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 12
	addi $t4,$t4,4
	lw $t1,0($t4)
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	sw $t1,0($t0) 
	j LABEL8
LABEL7:
LABEL8:
	li $t0, 12
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 8
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	addi $t4,$t4,4
	lw $t1,0($t4)
	sgt $t0, $t0, $t1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 0
	addi $t4,$t4,4
	lw $t1,0($t4)
	seq $t0, $t0, $t1
	bnez $t0, LABEL5
	li $t0, 0
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 24
	addi $t4,$t4,4
	lw $t1,0($t4)
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	sw $t1,0($t0) 
	j LABEL6
LABEL5:
LABEL6:
	j LABEL13
LABEL14:
	li $t0, 12
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 4
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	addi $t4,$t4,4
	lw $t1,0($t4)
	slt $t0, $t0, $t1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 0
	addi $t4,$t4,4
	lw $t1,0($t4)
	seq $t0, $t0, $t1
	bnez $t0, LABEL3
	addi $sp,$sp,4
	sw $ra, 4($sp)
	la $t1, CURRENT_HEAPPTR
	lw $t2,0($t1)
	addi $sp,$sp,4
	sw $t2, 4($sp)
	la $t1, CURRENT_HEAPSIZE
	lw $t2, 0($t1)
	addi $sp,$sp,4
	sw $t2, 4($sp)
	li $t0, 4
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	addi $sp,$sp,4
	sw $t0, 4($sp)
	li $t0, 12
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	addi $sp,$sp,4
	sw $t0, 4($sp)
	la $t1, CURRENT_HEAPPTR
	lw $t2,0($t1)
	la $t1, CURRENT_HEAPSIZE
	lw $t3, 0($t1)
	add $t2, $t2, $t3
	la $t1, CURRENT_HEAPPTR
	sw $t2, 0($t1)
	la $t1, quickSort_HEAPSIZE
	lw $t3,0($t1)
	la $t1, CURRENT_HEAPSIZE
	sw $t3,0($t1)
	la $t1, quickSort_HEAP
	sw $t2, 0($t1)
	jal quickSort
	lw $t2,4($sp)
	addi $sp, $sp, -4
	la $t1, CURRENT_HEAPSIZE
	sw $t2, 0($t1)
	lw $t2,4($sp)
	addi $sp, $sp, -4
	la $t1, CURRENT_HEAPPTR
	sw $t2,0($t1)
	la $t1, quickSort_HEAP
	sw $t2, 0($t1)
	lw $ra,4($sp)
	addi $sp, $sp, -4
	j LABEL4
LABEL3:
LABEL4:
	li $t0, 0
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 8
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	addi $t4,$t4,4
	lw $t1,0($t4)
	slt $t0, $t0, $t1
	sw $t0, 0($t4)
	addi $t4,$t4,-4
	li $t0, 0
	addi $t4,$t4,4
	lw $t1,0($t4)
	seq $t0, $t0, $t1
	bnez $t0, LABEL1
	addi $sp,$sp,4
	sw $ra, 4($sp)
	la $t1, CURRENT_HEAPPTR
	lw $t2,0($t1)
	addi $sp,$sp,4
	sw $t2, 4($sp)
	la $t1, CURRENT_HEAPSIZE
	lw $t2, 0($t1)
	addi $sp,$sp,4
	sw $t2, 4($sp)
	li $t0, 8
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	addi $sp,$sp,4
	sw $t0, 4($sp)
	li $t0, 0
	la $t2, quickSort_HEAP
	lw $t3,0($t2)
	add $t3, $t3, $t0
	move $t0, $t3
	lw $t0, 0($t0)
	addi $sp,$sp,4
	sw $t0, 4($sp)
	la $t1, CURRENT_HEAPPTR
	lw $t2,0($t1)
	la $t1, CURRENT_HEAPSIZE
	lw $t3, 0($t1)
	add $t2, $t2, $t3
	la $t1, CURRENT_HEAPPTR
	sw $t2, 0($t1)
	la $t1, quickSort_HEAPSIZE
	lw $t3,0($t1)
	la $t1, CURRENT_HEAPSIZE
	sw $t3,0($t1)
	la $t1, quickSort_HEAP
	sw $t2, 0($t1)
	jal quickSort
	lw $t2,4($sp)
	addi $sp, $sp, -4
	la $t1, CURRENT_HEAPSIZE
	sw $t2, 0($t1)
	lw $t2,4($sp)
	addi $sp, $sp, -4
	la $t1, CURRENT_HEAPPTR
	sw $t2,0($t1)
	la $t1, quickSort_HEAP
	sw $t2, 0($t1)
	lw $ra,4($sp)
	addi $sp, $sp, -4
	j LABEL2
LABEL1:
LABEL2:
	jr $ra
quickSort_end:
	addi $sp,$sp,4
	sw $ra, 4($sp)
	la $t1, CURRENT_HEAPPTR
	lw $t2,0($t1)
	addi $sp,$sp,4
	sw $t2, 4($sp)
	la $t1, CURRENT_HEAPSIZE
	lw $t2, 0($t1)
	addi $sp,$sp,4
	sw $t2, 4($sp)
	la $t1, CURRENT_HEAPPTR
	lw $t2,0($t1)
	la $t1, CURRENT_HEAPSIZE
	lw $t3, 0($t1)
	add $t2, $t2, $t3
	la $t1, CURRENT_HEAPPTR
	sw $t2, 0($t1)
	la $t1, fillArray_HEAPSIZE
	lw $t3,0($t1)
	la $t1, CURRENT_HEAPSIZE
	sw $t3,0($t1)
	la $t1, fillArray_HEAP
	sw $t2, 0($t1)
	jal fillArray
	lw $t2,4($sp)
	addi $sp, $sp, -4
	la $t1, CURRENT_HEAPSIZE
	sw $t2, 0($t1)
	lw $t2,4($sp)
	addi $sp, $sp, -4
	la $t1, CURRENT_HEAPPTR
	sw $t2,0($t1)
	la $t1, fillArray_HEAP
	sw $t2, 0($t1)
	lw $ra,4($sp)
	addi $sp, $sp, -4
	addi $sp,$sp,4
	sw $ra, 4($sp)
	la $t1, CURRENT_HEAPPTR
	lw $t2,0($t1)
	addi $sp,$sp,4
	sw $t2, 4($sp)
	la $t1, CURRENT_HEAPSIZE
	lw $t2, 0($t1)
	addi $sp,$sp,4
	sw $t2, 4($sp)
	la $t1, CURRENT_HEAPPTR
	lw $t2,0($t1)
	la $t1, CURRENT_HEAPSIZE
	lw $t3, 0($t1)
	add $t2, $t2, $t3
	la $t1, CURRENT_HEAPPTR
	sw $t2, 0($t1)
	la $t1, printArray_HEAPSIZE
	lw $t3,0($t1)
	la $t1, CURRENT_HEAPSIZE
	sw $t3,0($t1)
	la $t1, printArray_HEAP
	sw $t2, 0($t1)
	jal printArray
	lw $t2,4($sp)
	addi $sp, $sp, -4
	la $t1, CURRENT_HEAPSIZE
	sw $t2, 0($t1)
	lw $t2,4($sp)
	addi $sp, $sp, -4
	la $t1, CURRENT_HEAPPTR
	sw $t2,0($t1)
	la $t1, printArray_HEAP
	sw $t2, 0($t1)
	lw $ra,4($sp)
	addi $sp, $sp, -4
	addi $sp,$sp,4
	sw $ra, 4($sp)
	jal PrintLn
	lw $ra,4($sp)
	addi $sp, $sp, -4
	addi $sp,$sp,4
	sw $ra, 4($sp)
	la $t1, CURRENT_HEAPPTR
	lw $t2,0($t1)
	addi $sp,$sp,4
	sw $t2, 4($sp)
	la $t1, CURRENT_HEAPSIZE
	lw $t2, 0($t1)
	addi $sp,$sp,4
	sw $t2, 4($sp)
	li $t0, 1
	addi $sp,$sp,4
	sw $t0, 4($sp)
	li $t0, 20
	addi $sp,$sp,4
	sw $t0, 4($sp)
	la $t1, CURRENT_HEAPPTR
	lw $t2,0($t1)
	la $t1, CURRENT_HEAPSIZE
	lw $t3, 0($t1)
	add $t2, $t2, $t3
	la $t1, CURRENT_HEAPPTR
	sw $t2, 0($t1)
	la $t1, quickSort_HEAPSIZE
	lw $t3,0($t1)
	la $t1, CURRENT_HEAPSIZE
	sw $t3,0($t1)
	la $t1, quickSort_HEAP
	sw $t2, 0($t1)
	jal quickSort
	lw $t2,4($sp)
	addi $sp, $sp, -4
	la $t1, CURRENT_HEAPSIZE
	sw $t2, 0($t1)
	lw $t2,4($sp)
	addi $sp, $sp, -4
	la $t1, CURRENT_HEAPPTR
	sw $t2,0($t1)
	la $t1, quickSort_HEAP
	sw $t2, 0($t1)
	lw $ra,4($sp)
	addi $sp, $sp, -4
	addi $sp,$sp,4
	sw $ra, 4($sp)
	la $t1, CURRENT_HEAPPTR
	lw $t2,0($t1)
	addi $sp,$sp,4
	sw $t2, 4($sp)
	la $t1, CURRENT_HEAPSIZE
	lw $t2, 0($t1)
	addi $sp,$sp,4
	sw $t2, 4($sp)
	la $t1, CURRENT_HEAPPTR
	lw $t2,0($t1)
	la $t1, CURRENT_HEAPSIZE
	lw $t3, 0($t1)
	add $t2, $t2, $t3
	la $t1, CURRENT_HEAPPTR
	sw $t2, 0($t1)
	la $t1, printArray_HEAPSIZE
	lw $t3,0($t1)
	la $t1, CURRENT_HEAPSIZE
	sw $t3,0($t1)
	la $t1, printArray_HEAP
	sw $t2, 0($t1)
	jal printArray
	lw $t2,4($sp)
	addi $sp, $sp, -4
	la $t1, CURRENT_HEAPSIZE
	sw $t2, 0($t1)
	lw $t2,4($sp)
	addi $sp, $sp, -4
	la $t1, CURRENT_HEAPPTR
	sw $t2,0($t1)
	la $t1, printArray_HEAP
	sw $t2, 0($t1)
	lw $ra,4($sp)
	addi $sp, $sp, -4
	jr $ra

Print:
	lw $a0, 4($sp)
	addi $sp, $sp, -4
	li $v0, 1
	syscall
	li $v0,4
	la $a0, sp
	syscall
	jr $ra
PrintLn:
	li $v0,4
	la $a0, cr
	syscall
	jr $ra
